package com.cloud.code.牛客网;

import java.util.Arrays;
import java.util.Scanner;

public class Test44 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int n = Integer.parseInt(scanner.nextLine());
            String line = scanner.nextLine();
            String[] splits = line.split(" ");
            int[] evePower = new int[splits.length];
            for (int i = 0; i < splits.length; i++) {
                evePower[i] = Integer.parseInt(splits[i]);
            }
            int target = Integer.parseInt(scanner.nextLine());
            Arrays.sort(evePower);
            int count = 0;
            int sum = 0;

            int start = 0;
            int ent = evePower.length-1;
            while (start < ent){
                sum = sum+evePower[ent];
                if(sum >= target){
                    ent --;
                    count++;
                    sum = 0;
                    continue;
                }
                sum = sum + evePower[start];
                if(sum >= target){
                    start ++;
                    ent --;
                    count++;
                    sum = 0;
                    continue;
                }
            }

            System.out.println(count);
        }
    }
}
